function addAll(strFrom,strTo) {
	var sValue,sText,i,j; 
	var sElement,flag=0;

	for (i=0; i<strFrom.length; i++) {
		sValue = strFrom.options[i].value;
		sText  = strFrom.options[i].text;

		flag = 0;
		for (j=0; j < strTo.length; j++) 
				if (strTo.options[j].value == sValue) flag = 1; 	//is exist

		if (flag == 0) {
		     	sElement = document.createElement("OPTION");
		     	sElement.text  = sText;
		     	sElement.value = sValue;
		     	strTo.add(sElement);
		}
	}
}

function  deleteAll(strTo){
	var i;

	for (i=strTo.length-1; i>=0;i--){
		strTo.options.remove(i);
	}
}

function addItem(sel,sValue,sText) {
	var sElement = document.createElement("OPTION");
	sElement.text  = sText;
	sElement.value = sValue;
	sel.add(sElement);	
}

function selectItem(strSFrom,strSTo) {
	var sIndex,sValue,i;
	var flag = 0; //do not exist this element in strSTo Select
	var strElement;

	sIndex = strSFrom.selectedIndex;
	sValue = strSFrom.options[sIndex].value;
	
	for (i=0; i < strSTo.length; i++) 
		if (strSTo.options[i].value == sValue) flag = 1; 	//is exist

	if (flag == 0) {
		strElement = document.createElement("OPTION");
		strElement.text  = strSFrom.options[sIndex].text;
		strElement.value = sValue;
		strSTo.add(strElement);
	}
}

function addSelected(sltFrom,sltTo) {
	var sValue,i,j,count;
	var flag = 0; //do not exist this element in strSTo Select
	var strElement;
	
	for (j=0; j<sltFrom.length; j++) {
		if (sltFrom.options[j].selected) {
			sValue = sltFrom.options[j].value;
			flag = 0;
			for (i=0; i < sltTo.length; i++) 
				if (sltTo.options[i].value == sValue) flag = 1; 	//is exist

			if (flag == 0) {	      
				strElement = document.createElement("OPTION");
				strElement.text=sltFrom.options[j].text;
				strElement.value=sValue;
				sltTo.add(strElement);
			}
		}
	}
}

function deleteSelected(sltDept) {
	var i,flag;
	
	flag = 0;
	for (i=sltDept.length-1; i>=0; i--) {
		if (sltDept.options[i].selected) {
			sltDept.options.remove(i);
			
		}
	}
}
